package com.heima.wemedia.v1.controller;

import com.heima.common.dtos.FindNewsCommentsDto;
import com.heima.common.dtos.PageResult;
import com.heima.common.threadlocal.UserThreadLocalUtils;
import com.heima.feign.ArticleFeign;
import com.heima.feign.CommentFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: leadnews---practical--3
 * @BelongsPackage: com.heima.wemedia.v1.controller
 * @Author: 栋哥
 * @CreateTime: 2023-06-12  15:21
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
public class CommentController {

    @Autowired
    private CommentFeign commentFeign;

    @PostMapping("/api/v1/comment/manage/find_news_comments")
    public PageResult findNewsComments(@RequestBody FindNewsCommentsDto dto){

        Integer userId = UserThreadLocalUtils.getUserId();

        dto.setUserId(userId);
        return commentFeign.findNewsComments(dto);
    }

}
